package com.meizu.asum.richtextsdk.uiframework.xuidesign.utils.view;

import android.util.TypedValue;
import android.widget.TextView;

/**
 * @Author XJW
 * @CreateTime 2017/9/14
 */
public class TextViewTools {
    private TextView view;

    public TextViewTools with(TextView view) {
        this.view = view;
        view.setIncludeFontPadding(false);
        return this;
    }

    public TextViewTools set(double textSize, int textColor, int textGravity) {
        view.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) textSize);
        view.setTextColor(textColor);
        view.setGravity(textGravity);
        return this;
    }

    public TextViewTools set(int textColor, int textGravity) {
        view.setTextColor(textColor);
        view.setGravity(textGravity);
        return this;
    }

    public TextViewTools set(double textSize, int textGravity) {
        view.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) textSize);
        view.setGravity(textGravity);
        return this;
    }

    public TextViewTools text(String text) {
        view.setText(text);
        return this;
    }
}
